package com.vecspace.data.numerical;

import java.io.IOException;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;

public class HNumericalJsonSerializer extends JsonSerializer<HNumerical>{

	@Override
	public void serialize(HNumerical numerical, JsonGenerator gen, SerializerProvider serializers) throws IOException {
		gen.writeStartObject();  
		gen.writeStringField("value", numerical.getText());
		gen.writeNumberField("numValue", numerical.getValue());//反序列化时，不会考虑numValue的值
		gen.writeEndObject();
	}

}
